/*************************************************************************
 * File Name:    B.cc
 * Author:       zero91
 * Mail:         jianzhang9102@gmail.com
 * Created Time: Sat 12 Oct 2013 09:30:51 AM CST
 * 
 * Description:  
 ************************************************************************/

#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>

using namespace std;

#define MAXB 1010

struct point_node {
    long long x, y;

    point_node(long long tx, long long ty) : x(tx), y(ty) {}
};

int
main(int argc, char *argv[])
{
    std::ios_base::sync_with_stdio(false);

    long long T, B;
    long long x1, y1, x2, y2;
    long long ansx, ansy, tans, ans_dist;

    cin >> T;
    for (long long k = 1; k <= T; ++k) {
        vector<point_node> people;

        cin >> B;
        for (long long i = 0; i < B; ++i) {
            cin >> x1 >> y1 >> x2 >> y2;
            for (long long s = x1; s <= x2; ++s) {
                for (long long t = y1; t <= y2; ++t) {
                    people.push_back(point_node(s,t));
                }
            }
        }
        ans_dist = -1;
        for (size_t i = 0; i < people.size(); ++i) {
            tans = 0;
            for (size_t j = 0; j < people.size(); ++j) {
                tans += llabs(people[j].x - people[i].x) + llabs(people[j].y - people[i].y);
            }
            if (ans_dist == -1) ans_dist = tans, ansx = people[i].x, ansy = people[i].y;

            if (tans < ans_dist) ans_dist = tans, ansx = people[i].x, ansy = people[i].y;

            if (tans == ans_dist && people[i].x < ansx) {
                ansx = people[i].x;
                ansy = people[i].y;
            }
        }
        cout << "Case #" << k << ": " << ansx << " " << ansy << " " << ans_dist << endl;
    }
    return 0;
}
